import React, {useEffect, useState} from 'react';
import {Typography} from 'antd';

const {Title} = Typography;

function Home(props) {

    let [user, setUser] = useState({name: ""})

    useEffect(() => {
        if (window.localStorage.getItem("user")) {
            setUser(JSON.parse(window.localStorage.getItem("user")))
        } else {
            props.history.push('/login')
        }
    }, [])
    return (
        <div>
            <Title level={3} style={{padding: 20}}>
                {user.name}, 欢迎进入管理后台
            </Title>
        </div>

    );
}

export default Home;